﻿<Window x:Class="SsTool.Metadata.Windows.CreateEntityMetadataWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="CreateEntityMetadataWindow" Height="500" Width="800" WindowStartupLocation="CenterScreen">
    <Grid Margin="5">
        <Grid.RowDefinitions>
            <RowDefinition Height="auto"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="auto"/>
        </Grid.RowDefinitions>
        <Grid Grid.Row="0">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <StackPanel Grid.Column="0" Margin="5">
                <TextBlock Text="Name:"/>
                <TextBox Text="{Binding Name,Mode=TwoWay}"/>

            </StackPanel>
            <StackPanel Grid.Column="1" Margin="5">
                <TextBlock Text="Capiton:"/>
                <TextBox Text="{Binding Caption,Mode=TwoWay}"/>
            </StackPanel>
        </Grid>
        <Grid Grid.Row="1">
            <Grid.RowDefinitions>
                <RowDefinition Height="auto"/>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>
            <StackPanel Grid.Row="0" Orientation="Horizontal">
                <Button Content="Add Property" Name="_ctlBtnCreate" Click="_ctlBtnCreate_Click" Margin="5" />
                <Button Content="Upate Property" Name="_ctlBtnUpdate" Margin="5" Click="_ctlBtnUpdate_Click" />
            </StackPanel>
            <DataGrid Grid.Row="1" Name="_ctlGridProperty" ItemsSource="{Binding Properties, Mode=TwoWay}" IsReadOnly="True" AutoGenerateColumns="False">
                <DataGrid.Columns>
                    <DataGridTextColumn Header="Caption" Binding="{Binding Caption}" Width="*"/>
                    <DataGridTextColumn Header="Name" Binding="{Binding Name}" Width="*"/>
                    <DataGridCheckBoxColumn Header="Identity" Binding="{Binding Path=IsIdentity}"/>
                    <DataGridCheckBoxColumn Header="系统字段" Binding="{Binding Path=IsSystem}"/>
                    <DataGridTextColumn Header="Type" Binding="{Binding Path=Type.Caption}" Width="*"/>
                    <DataGridTextColumn Header="MinLength" Binding="{Binding Path=MinLength}" Width="*"/>
                    <DataGridTextColumn Header="MaxLength" Binding="{Binding Path=MaxLength}" Width="*"/>
                    <DataGridTextColumn Header="Order" Binding="{Binding Path=OrderIndex}" Width="*"/>
                </DataGrid.Columns>
            </DataGrid>
            
        </Grid>
        <StackPanel Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Center">
            <Button Content="Submit" Name="_ctlBtnSubmit" Click="_ctlBtnSubmit_Click" Margin="5" />
        </StackPanel>
    </Grid>
</Window>
